package com.juncdut.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.client.RestTemplate;

@Service
public class HelloHystrixService {

    @Autowired
    RestTemplate restTemplate;

    @GetMapping("/hello")
    public String hello(){
        String forObject = restTemplate.getForObject("http://config/system/hello", String.class);
        System.out.println("收到："+forObject);
        return forObject;
    }

    public String helloFallback() {
        return "error";
    }

}
